﻿using EMoney.IStock.Client.Core;
using EMoney.IStock.Client.DataAccess.CQ;
using EMoney.IStock.Client.Framework;
using EMoney.IStock.Client.Models;
using EMoney.IStock.Client.Models.CQ;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using ThinkDev.Logging;

namespace EMoney.IStock.Client.Business.CQ
{
    /// <summary>
    /// 竞猜处理业务类
    /// </summary>
    public class GuessProcessBll
    {
        //上一交易日竞猜结果（胜、败 比例）
        //晋级、出局人数比例
        //15点后计算竞猜结果

        /// <summary>
        /// 处理竞猜结果(收盘后至15:30执行一次)
        /// </summary>
        public static void ProcessGuess()
        {
            try
            {
                DateTime dtNow = DateTime.Now;
                string noticeMsg = string.Empty;

                if (TradeDateBll.IsTradeDate(dtNow.Date))   //当前是交易日
                {
                    if (dtNow.TimeOfDay >= new TimeSpan(15, 5, 0) && dtNow.TimeOfDay < new TimeSpan(15, 30, 0)) //15:05~15:30
                    {
                        MyGuessDal myGuessDal = new MyGuessDal();

                        List<MyGuess> listMyGuess = myGuessDal.GetGuessListByTradeDate(dtNow.Date);

                        if (listMyGuess != null && listMyGuess.Count > 0)    //存在竞猜数量
                        {
                            NetHelper net = new NetHelper();

                            string result = net.GetClientBySocket(string.Concat(ConfigHelper.HQService, "zshq.ashx?code=000001"), Encoding.GetEncoding("gbk"));  //获取上证指数行情

                            if (!string.IsNullOrEmpty(result))
                            {
                                StockPrice stockPrice = null;
                                List<StockPrice> stockPriceList = JsonHelper.ToObject<List<StockPrice>>(result);

                                if (stockPriceList != null && stockPriceList.Count > 0)
                                {
                                    stockPrice = stockPriceList[0];

                                    int correctCount = 0;
                                    int errorCount = 0;
                                    int promotionCount = 0;
                                    List<int> promotionUserIDList = new List<int>();
                                    int reviveCount = 0;
                                    List<int> reviveUserIDList = new List<int>();

                                    int curGuessType = -1;  //平盘

                                    if (stockPrice.F.Value > 0) //上涨
                                    {
                                        curGuessType = 1;
                                    }
                                    else if (stockPrice.F.Value < 0)    //下跌
                                    {
                                        curGuessType = 0;
                                    }

                                    List<int> listPromotionUserID = myGuessDal.GetPromotionUserIDList(); //晋级用户编号列表

                                    if (listPromotionUserID != null && listPromotionUserID.Count > 0) //已存在晋级人数
                                    {
                                        List<MyGuess> promotionGuessList = myGuessDal.GetPromotionUserGuessListByTradeDate(dtNow.Date); //获取晋级用户当前交易日的竞猜信息

                                        if (promotionGuessList != null && promotionGuessList.Count > 0) //晋级用户当前存在竞猜信息
                                        {
                                            List<MyGuess> correctGuessList = promotionGuessList.FindAll(g => g.GuessType == curGuessType);  //竞猜正确的信息

                                            if (correctGuessList != null && correctGuessList.Count > 0)
                                            {
                                                if (correctGuessList.Count == 1)    //仅1人竞猜正确，传奇诞生
                                                {
                                                    #region
                                                    correctCount++;
                                                    promotionCount++;
                                                    promotionUserIDList.Add(correctGuessList[0].UserID);                                                    

                                                    //更新竞猜信息
                                                    UpdateGuessResult(1, true, correctGuessList[0].UserID, correctGuessList[0].TradeDate);

                                                    //更新连续竞猜结果
                                                    UpdateContinueGuess(correctGuessList[0].UserID, correctGuessList[0].TradeDate, 1);

                                                    CacheManager.DefaultCache.Set<int>(GuessConstDefine.CQ_CACHED_KEY, correctGuessList[0].UserID);    //保存传奇人物信息
                                                    #endregion
                                                }
                                                else    //已晋级用户多人竞猜正确时，更新竞猜信息及连续竞猜结果
                                                {
                                                    #region
                                                    foreach (MyGuess guess in correctGuessList)
                                                    {
                                                        correctCount++;
                                                        promotionCount++;
                                                        promotionUserIDList.Add(guess.UserID);

                                                        //更新竞猜信息
                                                        UpdateGuessResult(1, true, guess.UserID, guess.TradeDate);

                                                        //更新连续竞猜结果
                                                        UpdateContinueGuess(guess.UserID, guess.TradeDate, 1);
                                                    }
                                                    #endregion
                                                }

                                                //竞猜错误的信息
                                                #region
                                                List<MyGuess> errorGuessList = promotionGuessList.FindAll(g => g.GuessType != curGuessType);

                                                if (errorGuessList != null && errorGuessList.Count > 0)
                                                {
                                                    foreach (MyGuess guess in errorGuessList)
                                                    {
                                                        errorCount++;
                                                        //更新竞猜信息
                                                        UpdateGuessResult(0, false, guess.UserID, guess.TradeDate);

                                                        myGuessDal.UpdateGuessOut(guess.UserID); //更新为 出局

                                                        //更新连续竞猜结果
                                                        UpdateContinueGuess(guess.UserID, guess.TradeDate, 0);
                                                    }
                                                }
                                                #endregion
                                            }
                                            else    //晋级用户不存在竞猜正确的信息，大于1人时复活，等于1人时活动结束
                                            {
                                                #region
                                                if (promotionGuessList.Count > 1)
                                                {
                                                    foreach (MyGuess guess in promotionGuessList)
                                                    {
                                                        reviveCount++;
                                                        reviveUserIDList.Add(guess.UserID);
                                                        //更新竞猜信息
                                                        UpdateGuessResult(-1, true, guess.UserID, guess.TradeDate);
                                                    }
                                                }
                                                else
                                                {
                                                    foreach (MyGuess guess in promotionGuessList)
                                                    {
                                                        errorCount++;
                                                        //reviveUserIDList.Add(guess.UserID);
                                                        //更新竞猜信息
                                                        UpdateGuessResult(0, false, guess.UserID, guess.TradeDate);

                                                        myGuessDal.UpdateGuessOut(guess.UserID); //更新为 出局

                                                        //更新连续竞猜结果
                                                        UpdateContinueGuess(guess.UserID, guess.TradeDate, 0);
                                                    }
                                                }
                                                #endregion
                                            }                                            
                                        }
                                        //else    
                                        //{ 
                                        //已晋级用户，当天无竞猜数据时，更新为出局，活动结束
                                        foreach(int promotionUserID in listPromotionUserID)
                                        {
                                            if (promotionGuessList.Find(lst => lst.UserID == promotionUserID) == null)
                                            {
                                                myGuessDal.UpdateGuessOut(promotionUserID); //更新为 出局
                                            }
                                        }
                                        //}

                                        int guessResult = 0;

                                        //更新非晋级用户当前交易日的竞猜信息
                                        #region
                                        foreach (MyGuess guess in listMyGuess)
                                        {
                                            if (!listPromotionUserID.Contains(guess.UserID))
                                            {
                                                if (guess.GuessType == curGuessType)
                                                {
                                                    correctCount++;
                                                    guessResult = 1;
                                                }
                                                else
                                                {
                                                    errorCount++;
                                                    guessResult = 0;
                                                }

                                                //更新竞猜信息
                                                UpdateGuessResult(guessResult, false, guess.UserID, guess.TradeDate);

                                                //更新连续竞猜结果
                                                UpdateContinueGuess(guess.UserID, guess.TradeDate, guessResult);
                                            }
                                        }
                                        #endregion
                                    }
                                    else    //不存在晋级的用户
                                    {
                                        #region
                                        int guessResult = 0;
                                        bool isPromotion = false;
                                        foreach (MyGuess guess in listMyGuess)
                                        {
                                            if (guess.GuessType == curGuessType)
                                            {
                                                correctCount++;
                                                guessResult = 1;
                                                isPromotion = true;
                                                promotionCount++;
                                                promotionUserIDList.Add(guess.UserID);
                                            }
                                            else
                                            {
                                                errorCount++;
                                                guessResult = 0;
                                                isPromotion = false;
                                            }

                                            //更新竞猜信息
                                            UpdateGuessResult(guessResult, isPromotion, guess.UserID, guess.TradeDate);

                                            //更新连续竞猜结果
                                            UpdateContinueGuess(guess.UserID, guess.TradeDate, guessResult);
                                        }

                                        if (correctCount == 1)  //当只有一人猜对时，传奇诞生
                                        {
                                            if (promotionUserIDList != null && promotionUserIDList.Count > 0)
                                            {
                                                CacheManager.DefaultCache.Set<int>(GuessConstDefine.CQ_CACHED_KEY, promotionUserIDList[0]);    //保存传奇人物信息
                                            }
                                        }
                                        #endregion
                                    }

                                    GuessResultStat(listMyGuess[0].TradeDate, correctCount, errorCount, promotionCount, reviveCount);  //竞猜结果统计
                                    PromotionOutCount(listMyGuess[0].TradeDate);    //统计晋级出局人数

                                    StringBuilder sbNoticeMsg = new StringBuilder();

                                    sbNoticeMsg.Append("处理").Append(StringHelper.FormatDateTime(listMyGuess[0].TradeDate));
                                    sbNoticeMsg.Append("竞猜结果成功。该日竞猜人数：").Append(listMyGuess.Count);
                                    sbNoticeMsg.Append("，猜对人数：").Append(correctCount);
                                    sbNoticeMsg.Append("，猜错人数：").Append(errorCount);
                                    sbNoticeMsg.Append("，晋级人数：").Append(promotionCount);
                                    if (promotionUserIDList != null && promotionUserIDList.Count > 0)
                                    {
                                        sbNoticeMsg.Append("(").Append(string.Join(",", promotionUserIDList.ToArray())).Append(")");
                                    }

                                    sbNoticeMsg.Append("，复活人数：").Append(reviveCount);
                                    if (reviveUserIDList != null && reviveUserIDList.Count > 0)
                                    {
                                        sbNoticeMsg.Append("(").Append(string.Join(",", reviveUserIDList.ToArray())).Append(")");
                                    }

                                    noticeMsg = sbNoticeMsg.ToString();
                                }
                                else
                                {
                                    noticeMsg = "上证指数行情格式错误";
                                }
                            }
                            else
                            {
                                noticeMsg = "未获取到上证指数行情";
                            }
                        }
                        else
                        {
                            noticeMsg = string.Concat(StringHelper.FormatDateTime(dtNow), "不存在竞猜信息");
                        }

                        if (!string.IsNullOrEmpty(noticeMsg))
                        {
                            LogManager.DefaultLogger.Debug(noticeMsg);

                            SendHelper.SendEmail("xuqing0303@emoney.cn", string.Concat(StringHelper.FormatDateTime(dtNow), "《我是传奇》竞猜结果"), noticeMsg);
                            SendHelper.SendEmail("zhengchangxin@emoney.cn", string.Concat(StringHelper.FormatDateTime(dtNow), "《我是传奇》竞猜结果"), noticeMsg);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.DefaultLogger.Error(LogConvert.ParseWebEx(ex), "处理竞猜结果失败");
            }
        }

        /// <summary>
        /// 统计总的竞猜人数(一分钟执行一次)
        /// </summary>
        public static void ProcessTotal()
        {
            try
            {
                bool canGuess = false;
                DateTime dtNow = DateTime.Now;
                
                MyGuessBll myGuessBll = new MyGuessBll();

                DateTime guessDate = myGuessBll.GetGuessDate(out canGuess);

                if (canGuess || dtNow.TimeOfDay <= new TimeSpan(9, 16, 0))
                {                    
                    MyGuessDal myGuessDal = new MyGuessDal();

                    int totalCount = myGuessDal.GetGuessUserCount();

                    if (totalCount > 0)
                    {
                        GuessTotal guessTotal = new GuessTotal()
                        {
                            StatTime = dtNow,
                            Count = totalCount
                        };

                        CacheManager.DefaultCache.Set<GuessTotal>(GuessConstDefine.TOTALCOUNT_CACHED_KEY, guessTotal);
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.DefaultLogger.Error(LogConvert.ParseWebEx(ex), "统计总的竞猜人数失败");
            }
        }

        /// <summary>
        /// 汇总竞猜记录(一分钟执行一次)
        /// </summary>
        public static void ProcessGuessType()
        {
            try
            {
                bool canGuess = false;
                DateTime dtNow = DateTime.Now;

                MyGuessBll myGuessBll = new MyGuessBll();

                DateTime guessDate = myGuessBll.GetGuessDate(out canGuess);

                if (canGuess || dtNow.TimeOfDay <= new TimeSpan(9, 16, 0))
                {
                    bool isAdd = false;
                    GuessType guessType = new GuessType();
                    MyGuessDal myGuessDal = new MyGuessDal();

                    List<GuessType> listGuessType = CacheManager.DefaultCache.Get<List<GuessType>>(GuessConstDefine.GUESSTYPE_CACHED_KEY);

                    if (listGuessType != null && listGuessType.Count > 0)
                    {
                        guessType = listGuessType.Find(lst => lst.TradeDate == guessDate);

                        if (guessType == null)
                        {
                            isAdd = true;
                            guessType = new GuessType();
                        }
                    }
                    else
                    {
                        isAdd = true;
                        listGuessType = new List<GuessType>();
                    }

                    DataTable dtType = myGuessDal.GetGuessTypeByTradeDate(guessDate);

                    if (dtType != null && dtType.Rows.Count > 0)
                    {
                        guessType.TradeDate = guessDate;

                        foreach (DataRow row in dtType.Rows)
                        {
                            if (row["GuessType"] != DBNull.Value)
                            {
                                switch (Convert.ToInt32(row["GuessType"]))
                                {
                                    case 1:
                                        guessType.UpCount = Convert.ToInt32(row["count"]);
                                        break;
                                    case 0:
                                        guessType.DownCount = Convert.ToInt32(row["count"]);
                                        break;
                                    default:
                                        break;
                                }
                            }
                        }

                        if (isAdd)
                        {
                            listGuessType.Add(guessType);
                        }

                        CacheManager.DefaultCache.Set<List<GuessType>>(GuessConstDefine.GUESSTYPE_CACHED_KEY,listGuessType);
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.DefaultLogger.Error(LogConvert.ParseWebEx(ex), "汇总竞猜记录失败");
            }
        }

        /// <summary>
        /// 统计晋级出局人数
        /// </summary>
        public static void PromotionOutCount(DateTime tradeDate)
        {
            try
            {
                MyGuessDal myGuessDal = new MyGuessDal();

                int promotionCount = myGuessDal.GetPromotionUserCount();    //晋级人数
                int outCount = myGuessDal.GetOutUserCount();    //出局人数

                if (promotionCount > 0 || outCount > 0)
                {
                    List<PromotionOutCount> promotionOutCountList = CacheManager.DefaultCache.Get<List<PromotionOutCount>>(GuessConstDefine.PROMOTIONOUTCOUNT_CACHED_KEY);

                    if (promotionOutCountList != null && promotionOutCountList.Count > 0)
                    {
                        PromotionOutCount promotionOutCount = promotionOutCountList.Find(lst => lst.TradeDate == tradeDate.Date);

                        if (promotionOutCount == null)
                        {
                            promotionOutCountList.Add(new Models.CQ.PromotionOutCount()
                            {
                                TradeDate = tradeDate.Date,
                                PromotionCount = promotionCount,
                                OutCount = outCount
                            });
                        }
                        else
                        {
                            promotionOutCount.OutCount = outCount;
                            promotionOutCount.PromotionCount = promotionCount;
                        }
                    }
                    else
                    {
                        promotionOutCountList = new List<PromotionOutCount>();

                        promotionOutCountList.Add(new Models.CQ.PromotionOutCount()
                        {
                            TradeDate = tradeDate.Date,
                            PromotionCount = promotionCount,
                            OutCount = outCount
                        });
                    }

                    CacheManager.DefaultCache.Set<List<PromotionOutCount>>(GuessConstDefine.PROMOTIONOUTCOUNT_CACHED_KEY, promotionOutCountList);
                }
            }
            catch (Exception ex)
            {
                LogManager.DefaultLogger.Error(LogConvert.ParseWebEx(ex), "统计晋级出局人数失败");
            }            
        }

        /// <summary>
        /// 统计竞猜数据
        /// </summary>
        public static void ProcessGuessData()
        {
            try
            {
                bool canGuess = false;
                DateTime dtNow = DateTime.Now;

                MyGuessBll myGuessBll = new MyGuessBll();
                StringBuilder retData = new StringBuilder();

                DateTime guessDate = myGuessBll.GetGuessDate(out canGuess);
                
                if (!canGuess && dtNow.TimeOfDay >= new TimeSpan(9, 15, 0) && dtNow.TimeOfDay < new TimeSpan(9, 30, 0))
                {
                    MyGuessDal myGuessDal = new MyGuessDal();

                    DataTable dtGuessTypeCount = myGuessDal.GetGuessTypeCount(guessDate.Date);

                    if (dtGuessTypeCount != null && dtGuessTypeCount.Rows.Count > 0)
                    {                       
                        retData.Append(StringHelper.FormatDateTime(guessDate)).Append(" 竞猜数据：<br/>");

                        foreach (DataRow row in dtGuessTypeCount.Rows)
                        {
                            if (row["GuessType"].ToString() == "0")
                            {
                                retData.Append("看跌人数：").Append(row["guesstypecount"]).Append("<br/>");
                            }
                            else if (row["GuessType"].ToString() == "1")
                            {
                                retData.Append("看涨人数：").Append(row["guesstypecount"]).Append("<br/>");
                            }
                        }

                        int promotionUserCount = myGuessDal.GetPromotionUserCount();

                        if (promotionUserCount > 0) //存在晋级人数
                        {
                            DataTable dtPromotionGuessTypeCount = myGuessDal.GetPromotionGuessTypeCount(guessDate);

                            if (dtPromotionGuessTypeCount != null && dtPromotionGuessTypeCount.Rows.Count > 0)
                            {
                                int promotionUserGuessCount = 0;

                                foreach (DataRow row in dtPromotionGuessTypeCount.Rows)
                                {
                                    promotionUserGuessCount += Convert.ToInt32(row["guesstypecount"]);

                                    if (row["GuessType"].ToString() == "0")
                                    {   
                                        retData.Append("晋级用户看跌人数：").Append(row["guesstypecount"]).Append("<br/>");
                                    }
                                    else if (row["GuessType"].ToString() == "1")
                                    {
                                        retData.Append("晋级用户看涨人数：").Append(row["guesstypecount"]).Append("<br/>");
                                    }
                                }

                                if (promotionUserCount > promotionUserGuessCount)
                                {
                                    retData.Append(promotionUserCount - promotionUserGuessCount).Append("名晋级用户未竞猜");
                                }
                            }
                            else
                            {
                                retData.Append("晋级用户未竞猜");
                            }
                        }
                    }

                    LogManager.DefaultLogger.Debug(retData.ToString());

                    SendHelper.SendEmail("xuqing0303@emoney.cn", string.Concat(StringHelper.FormatDateTime(guessDate), "《我是传奇》竞猜数据"), retData.ToString());
                    SendHelper.SendEmail("zhengchangxin@emoney.cn", string.Concat(StringHelper.FormatDateTime(guessDate), "《我是传奇》竞猜数据"), retData.ToString());
                }
            }
            catch (Exception ex)
            {
                LogManager.DefaultLogger.Error(LogConvert.ParseWebEx(ex), string.Concat("统计竞猜数据失败"));
            }            
        }

        /// <summary>
        /// 更新竞猜信息
        /// </summary>
        /// <param name="result"></param>
        /// <param name="promotion"></param>
        /// <param name="userid"></param>
        /// <param name="tradeDate"></param>
        private static void UpdateGuessResult(int result,bool promotion,int userid,DateTime tradeDate)
        {
            try
            {
                MyGuessDal myGuessDal = new MyGuessDal();

                myGuessDal.UpdateGuessResult(new MyGuess()
                {
                    GuessResult = result,
                    IsPromotion = promotion,
                    UserID = userid,
                    TradeDate = tradeDate
                });

                //MyGuessBll myGuessBll = new MyGuessBll();

                //MyGuess myGuess = myGuessBll.GetMyGuess(userid);

                //if (myGuess != null && myGuess.TradeDate == tradeDate)
                //{
                //    DateTime dtNow = DateTime.Now;

                //    myGuess.GuessResult = result;
                //    myGuess.IsPromotion = promotion;

                //    if (result == 1 && myGuess.UpdateTime.Date != dtNow.Date)
                //    {
                //        myGuess.CorrectGuessCount++;
                //    }

                //    myGuess.UpdateTime = dtNow;

                //    myGuessBll.SetMyGuess(myGuess, tradeDate);
                //}
            }
            catch (Exception ex)
            {
                LogManager.DefaultLogger.Error(LogConvert.ParseWebEx(ex), string.Concat("更新竞猜信息失败.", userid, ".", StringHelper.FormatDateTime(tradeDate), ".", result, ".", promotion));
            }            
        }

        /// <summary>
        /// 更新连续竞猜结果
        /// </summary>
        /// <param name="userid">用户编号</param>
        /// <param name="tradeDate">交易日期</param>
        /// <param name="result">竞猜结果 1:对 0:错</param>
        private static void UpdateContinueGuess(int userid, DateTime tradeDate, int result)
        {
            try
            {
                DateTime dtPreTradeDate = TradeDateBll.GetPreTradeDate(tradeDate.Date);

                ContinueGuessDal continueGuessDal = new ContinueGuessDal();

                ContinueGuess continueGuess = continueGuessDal.GetContinueGuess(userid, dtPreTradeDate, result);

                if (continueGuess != null)
                {
                    continueGuess.ContinueDays++;
                    continueGuess.TradeDate = tradeDate;
                }
                else
                {
                    continueGuess = new ContinueGuess()
                    {
                        UserID = userid,
                        TradeDate = tradeDate,
                        ContinueDays = 1,
                        GuessResult = result
                    };
                }

                continueGuessDal.AddContinueGuess(continueGuess);   //新增连续竞猜记录

                //MyGuessBll myGuessBll = new MyGuessBll();

                //MyGuess myGuess = myGuessBll.GetMyGuess(userid);

                //if (myGuess != null && myGuess.TradeDate == tradeDate)
                //{
                //    myGuess.ContinueCorrectGuessCount = continueGuessDal.GetMaxContinueDays(userid, 1); //连续猜对
                //    myGuess.ContinueErrorGuessCount = continueGuessDal.GetMaxContinueDays(userid, 0);   //连续猜错

                //    myGuessBll.SetMyGuess(myGuess, tradeDate);
                //}
            }
            catch (Exception ex)
            {
                LogManager.DefaultLogger.Error(LogConvert.ParseWebEx(ex), string.Concat("更新连续竞猜结果失败.", userid, ".", StringHelper.FormatDateTime(tradeDate), ".", result));
            }
        }

        /// <summary>
        /// 竞猜结果统计
        /// </summary>
        /// <param name="tradeDate">交易日期</param>
        /// <param name="correctCount">猜对数量</param>
        /// <param name="errorCount">猜错数量</param>
        /// <param name="promotionCount">晋级数量</param>
        /// <param name="reviveCount">复活数量</param>
        public static void GuessResultStat(DateTime tradeDate, int correctCount, int errorCount, int promotionCount, int reviveCount)
        {
            List<GuessResult> resultList = CacheManager.DefaultCache.Get<List<GuessResult>>(GuessConstDefine.GUESSRESULT_CACHED_KEY);

            if (resultList != null && resultList.Count > 0)
            {
                GuessResult result = resultList.Find(lst => lst.TradeDate == tradeDate.Date);

                if (result != null)
                {
                    result.CorrectCount = correctCount;
                    result.ErrorCount = errorCount;
                    result.PromotionCount = promotionCount;
                    result.ReviveCount = reviveCount;
                }
                else
                {
                    resultList.Add(new GuessResult()
                    {
                        TradeDate = tradeDate,
                        CorrectCount = correctCount,
                        ErrorCount = errorCount,
                        PromotionCount = promotionCount,
                        ReviveCount = reviveCount
                    });
                }
            }
            else
            {
                resultList = new List<GuessResult>();

                resultList.Add(new GuessResult() { 
                    TradeDate = tradeDate,
                    CorrectCount = correctCount,
                    ErrorCount = errorCount,
                    PromotionCount = promotionCount,
                    ReviveCount = reviveCount
                });
            }

            CacheManager.DefaultCache.Set<List<GuessResult>>(GuessConstDefine.GUESSRESULT_CACHED_KEY, resultList);
        }
    }
}
